@echo on

echo set CAMINHO=%1
set CAMINHO=%1

echo set VERSAO=%2
set VERSAO=%2

echo set AMBIENTE=%3
set AMBIENTE=%3

echo set VERSAOPSE=%4
set VERSAOPSE=%4

echo set VERSAOPSECOMP=%5
set VERSAOPSECOMP=%5

echo set AMBIENTEPSE=%6
set AMBIENTEPSE=%6

echo set ITERACAO=%7
set ITERACAO=%7

echo set BD=%8
set BD=%8

echo set SERVIDOR=%9
set SERVIDOR=%9

shift

echo set TF=%9
set TF=%9

shift

echo set FOLDER=%9
set FOLDER=%9

shift

echo set UNIDADE=%9
set UNIDADE=%9

echo md \%FOLDER%
md \%FOLDER%

echo cd \%FOLDER%
cd \%FOLDER%

echo %TF% workspace /server:%SERVIDOR% /new work_space_temp_sinacor /noprompt
%TF% workspace /server:%SERVIDOR% /new work_space_temp_sinacor /noprompt

echo %TF% branch %CAMINHO%/Compilados/Deployment $/SINACOR/Setup/%AMBIENTE%/%VERSAO%/x86 /version:T
%TF% branch %CAMINHO%/Compilados/Deployment $/SINACOR/Setup/%AMBIENTE%/%VERSAO%/x86 /version:T

echo %TF% branch "$/SINACOR/ReleaseManager/Tools/Ferramentas para Build/Batchs_Setup/Console.bat" $/SINACOR/Setup/%AMBIENTE%/%VERSAO%/x86/Console.bat /version:T
%TF% branch "$/SINACOR/ReleaseManager/Tools/Ferramentas para Build/Batchs_Setup/Console.bat" $/SINACOR/Setup/%AMBIENTE%/%VERSAO%/x86/Console.bat /version:T

echo %TF% branch %CAMINHO%/Compilados/AuditLogging $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/AuditLogging /version:T /noget
%TF% branch %CAMINHO%/Compilados/AuditLogging $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/AuditLogging /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Certificates $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Certificates /version:T /noget
%TF% branch %CAMINHO%/Compilados/Certificates $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Certificates /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Common $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Common /version:T /noget
%TF% branch %CAMINHO%/Compilados/Common $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Common /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Core $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Core /version:T 
%TF% branch %CAMINHO%/Compilados/Core $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Core /version:T 

echo %TF% branch %CAMINHO%/Compilados/ExternalRef $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/ExternalRef /version:T /noget
%TF% branch %CAMINHO%/Compilados/ExternalRef $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/ExternalRef /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Infra $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Infra /version:T /noget
%TF% branch %CAMINHO%/Compilados/Infra $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Infra /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Processos $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Processos /version:T /noget
%TF% branch %CAMINHO%/Compilados/Processos $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Processos /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Registry $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Registry /version:T /noget
%TF% branch %CAMINHO%/Compilados/Registry $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Registry /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Servicos $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Servicos /version:T /noget
%TF% branch %CAMINHO%/Compilados/Servicos $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Servicos /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Tools $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Tools /version:T /noget
%TF% branch %CAMINHO%/Compilados/Tools $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Tools /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/UI $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/UI /version:T /noget
%TF% branch %CAMINHO%/Compilados/UI $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/UI /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Settings $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Settings /version:T /noget
%TF% branch %CAMINHO%/Compilados/Settings $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Settings /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/GeneralSettings.config $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/GeneralSettings.config /version:T /noget
%TF% branch %CAMINHO%/Compilados/GeneralSettings.config $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/GeneralSettings.config /version:T /noget

echo %TF% branch $/SINACOR/Setup/PROD/Scripts_%ITERACAO% $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Scripts /version:T
%TF% branch $/SINACOR/Setup/PROD/Scripts_%ITERACAO% $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Scripts /version:T

echo %TF% branch %CAMINHO%/Compilados/Versions $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Versions /version:T /noget
%TF% branch %CAMINHO%/Compilados/Versions $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Bin/Sinacor/Versions /version:T /noget

echo %TF% undo $/SINACOR/Setup/%AMBIENTE%/%VERSAO%/x86/SinacorWasConfigGenerator /recursive
%TF% undo $/SINACOR/Setup/%AMBIENTE%/%VERSAO%/x86/SinacorWasConfigGenerator /recursive

echo %TF% branch $/SinaINFR/NET/PROD/P1I9/SPK/Source/Infra_2.0/Deployment/Guides $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Guides /version:T /noget  
%TF% branch $/SinaINFR/NET/PROD/P1I9/SPK/Source/Infra_2.0/Deployment/Guides $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/Guides /version:T /noget  

echo %TF% branch $/PSE/Setup/%AMBIENTEPSE%/%VERSAOPSE%/x86 $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/ExternalSetup/PSE /version:T /noget
%TF% branch $/PSE/Setup/%AMBIENTEPSE%/%VERSAOPSE%/x86 $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/ExternalSetup/PSE /version:T /noget

echo %TF% branch $/PSEComponents/Setup/%AMBIENTEPSE%/%VERSAOPSECOMP%/x86 $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/ExternalSetup/PSEComponents /version:T /noget
%TF% branch $/PSEComponents/Setup/%AMBIENTEPSE%/%VERSAOPSECOMP%/x86 $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/x86/ExternalSetup/PSEComponents /version:T /noget

echo %TF% branch $/SINACOR/ReleaseManager/Tools/InstalacaoSinacorMais/Tools $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/Tools /version:T /noget
%TF% branch $/SINACOR/ReleaseManager/Tools/InstalacaoSinacorMais/Tools $/Sinacor/Setup/%AMBIENTE%/%VERSAO%/Tools /version:T /noget

echo %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\SetupGenerator.exe %VERSAO% %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\ %BD%
%UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\SetupGenerator.exe %VERSAO% %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\ %BD%

echo %TF% add %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\SetupConfiguration.xml
%TF% add %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\SetupConfiguration.xml

echo %TF% add %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\DataBaseScripts.xml
%TF% add %UNIDADE%:\%FOLDER%\SINACOR\Setup\%AMBIENTE%\%VERSAO%\x86\DataBaseScripts.xml

echo %TF% checkin /comment:"Montagem do Setup Sinacor da versao %VERSAO%" /notes:"Codigo Aprovado"="_svctfs" /override:"Montagem do Setup do Sinacor da versao %VERSAO%" /recursive /noprompt
%TF% checkin /comment:"Montagem do Setup Sinacor da versao %VERSAO%" /notes:"Codigo Aprovado"="_svctfs" /override:"Montagem do Setup do Sinacor da versao %VERSAO%" /recursive /noprompt

echo %TF% workspace /server:%SERVIDOR% /delete /noprompt work_space_temp_sinacor
%TF% workspace /server:%SERVIDOR% /delete /noprompt work_space_temp_sinacor

echo rd \%FOLDER%\Sinacor\Setup\%AMBIENTE%\%VERSAO%\ /s /q
rd \%FOLDER%\Sinacor\Setup\%AMBIENTE%\%VERSAO%\ /s /q